//创建模型对象
//4个步骤
//1导入mongooes 
const mongoose = require('mongoose')

// //2 实例化一个schema对象
// const schema = new mongoose.Schema({
// //模型规则  对应字段

// })

// //创建模型对象  2个参数 第一个是名称(对应数据库集合的名称)  第二个参数 规则
// const Obj = mongoose.model('names',schema)



//系统用户模型对象
const userSchema = new mongoose.Schema({

    name: String,
    id: String,
    pwd: String,
    tel: String,
    adress: String,
    role: String,
    IDCard: String,
    realName: String,
    baseSalary: String,
    reward: String,
    allowance: String,
    fine: String,

})

const User = mongoose.model('users', userSchema)


//订单模型对象
const orderSchema = new mongoose.Schema({

    runer: String,
    runerTel: String,
    runPrice: String,
    content: String,
    goodsPrice: String,
    type: String,
    starAdress: String,
    endAdress: String,
    orderId: String,
    orderStatus: String,
    paymentMethod: String,
    userName: String,
    realName: String,
    userTel: String,
    receiptRealname: String,
    receiptUsername: String,
    receiptTel: String,
    haveOrderTime: Date,
    haveOrderMan: String,
    receiptOrderTime: Date,
    latitudes: String,
    longitudes: String
})
const order = mongoose.model('order', orderSchema)


module.exports = {
    User,
    order
}